package com.bosssoft.user.permission.center.serve.api;

import com.bosssoft.user.permission.center.serve.pojo.query.UserEntity;
import com.bosssoft.user.permission.center.serve.dao.entity.UserRoleInfo;
import com.bosssoft.user.permission.center.serve.pojo.query.UserQuery;
import com.bosssoft.user.permission.center.serve.pojo.vo.UserVo;
import common.data.commonresponse.CommonPage;
import common.data.commonresponse.CommonResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "用户管理", value = "/api/v1/permission/user")
@RequestMapping("/api/v1/permission/user")
@Validated
//@CrossOrigin
public interface UserApi {
    /**
     * 用于进行用户管理以及用户token返回
     * @author daishengran
     * @date 2024/06/11 19:59
     * @param userQuery 前端传回的用户输入的用户管理信息
     * @return 返回用户信息token
     */
    @ApiOperation(value = "用户管理信息按条件查询",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/selectUserInfo",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<CommonPage<UserVo>> selectUserInfo(@RequestBody UserQuery userQuery);

    @ApiOperation(value = "查询用户角色信息",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/selectRoleList",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<CommonPage<UserRoleInfo>> selectRoleList();

    @ApiOperation(value = "用户管理信息查询",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/queryUserList",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<CommonPage<UserEntity>> queryUserList(@RequestBody UserQuery userQuery);

    @ApiOperation(value = "增加用户信息",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/addUserInfo",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> addUserInfo(@RequestBody UserEntity userEntity);

    @ApiOperation(value = "修改用户信息",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/modifyUserInfo",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> modifyUserInfo(@RequestBody UserEntity userEntity);

    @ApiOperation(value = "修改用户状态",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/modifyUserStatus",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> modifyUserStatus(@RequestBody UserEntity userEntity);

    @ApiOperation(value = "批量删除用户",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/deleteUsersByIds",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> deleteUsersByIds(@RequestBody List<String> ids);

    @ApiOperation(value = "批量启用用户",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/startUsers",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> startUsers(@RequestBody List<String> ids);

    @ApiOperation(value = "批量停用用户",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/shutUsers",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> shutUsers(@RequestBody List<String> ids);

    @ApiOperation(value = "删除单个用户",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/deleteUserById",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> deleteUserById(@RequestBody UserEntity userEntity);

    @ApiOperation(value = "给用户分配角色",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/allocateCharacter",method= RequestMethod.POST,headers = "Accept=application/json")
    CommonResponse<Boolean> allocateCharacter(@RequestBody UserQuery userQuery);

    @ApiOperation(value = "查询用户树",notes = "校验完成后返回token")
    @ApiResponses({
            @ApiResponse(code = 0,message = "请求成功"),
            @ApiResponse(code = -1,message = "请求失败")
    })
    @RequestMapping(value="/getTree",method= RequestMethod.GET,headers = "Accept=application/json")
    CommonResponse<Object> getTree();
}
